package me.jollyfly.jshop.user.client.model.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * @author jollyfly
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class LoginUserDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @Size(min = 2, max = 10, message = "用户名为2~10位")
    @NotNull
    private String username;

    @NotNull
    @Pattern(regexp = "^[a-zA-Z]\\w{5,17}$", message = "密码必须为：以字母开头，长度在6-18之间，只能包含字符、数字和下划线")
    private String password;


    @Pattern(regexp = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[0-9])|(18[0-9]))\\d{8}$", message = "请填写正确手机号")
    private String phone;

    @Pattern(regexp = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", message = "请输入正确邮箱")
    private String email;

    private String roles;

    private Date created;

    private Date updated;
}
